#include <stdio.h>
#define TRUE	1
#define	FALSE	0
#define WLENGTH	8
/*
 * Write a program to print a histogram of the lengths of words in its input. 
 * It is easy to draw the histogram with the bars horizontal; a vertical 
 * orientation is more challenging.
 */

int iswhite(int);

main(){
	int car, wlength;
	static int wlcount[WLENGTH];
	int inword = FALSE;
	wlength = 0;
	
	while((car = getchar()) != EOF){
		if(!iswhite(car)){
			if(!inword){
				inword = TRUE;
				wlength++;
			}else{
				wlength++;
			}
		}else{
			wlcount[wlength] = wlcount[wlength] + 1;
			inword = FALSE;
			wlength = 0;
		}
	}
	
	wlcount[wlength] = wlcount[wlength] + 1;
	
	printf("\n");
	
	int i = 1;	
	while(i<WLENGTH){
		printf("%d\t", i++);		
	}
	printf("\n");
	
	i=1;
	while(i<WLENGTH){
		int j=1;
		while(j<WLENGTH){
			if(wlcount[j++]>=i)
				printf("*\t");
			else
				printf("\t");
		}
		i++;
		printf("\n");
	}	
}

int iswhite(int car){
	return ((car == '\t') || (car == '\n') || (car == ' '));
}
